// 页面的控制权限
checkLogin()
// 用户名渲染
yonghuming()
// 退出登录
tuichudenglu()

async function xueshengxuanran() {
  const token = localStorage.getItem('token')
  const res = await axios.get('/students', {
    headers: { Authorization: token }
  })
  console.log(res)
  const {
    data: { data }
  } = res
  // console.log(data)
  document.querySelector('.list').innerHTML = data
    .map((ele, index) => {
      console.log(ele)
      return `<tr>
        <td>${ele.name}</td>
        <td>${ele.age}</td>
        <td>${ele.gender ? '男' : '女'}</td>
        <td>第${ele.group}组</td>
        <td>${ele.salary}</td>
        <td>${ele.hope_salary}</td>
        <td>${ele.province}${ele.city}${ele.area}</td>
        <td>
          <a href="javascript:;" class="text-success mr-3"><i class="bi bi-pen"></i></a>
          <a href="javascript:;" class="text-danger"><i class="bi bi-trash"></i></a>
        </td>
      </tr>`
    })
    .join('')
  document.querySelector('.total').innerHTML = data.length
}
xueshengxuanran()
//
//
//
//
// 显示弹框
const form = document.querySelector('#form')

const modalDom = document.querySelector('#modal')
const modal = new bootstrap.Modal(modalDom)
